package com.whl.sm.vo;


import com.whl.sm.model.dynamic.VDynamic;
import com.whl.sm.model.notice.Attachment;
import com.whl.sm.model.system.OrgUser;
import com.whl.sm.model.system.OrgUserInfo;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import java.util.Objects;

@Data
@NoArgsConstructor
public class DynamicUserVo implements Serializable {

    /**
     * VO构造函数
     * */
    public DynamicUserVo(VDynamic dynamic, OrgUser user, OrgUserInfo userInfo, List<String> linkImg,Boolean likeStatus) {
        if (Objects.nonNull(dynamic)){
            this.id = dynamic.getId();
            this.content = dynamic.getContent();
            this.likeCount = dynamic.getLikeCount();
            this.createTime = dynamic.getCreateTime();
            this.operator = dynamic.getOperator();
        }
        if (Objects.nonNull(user)){
            this.operator = user.getId();
            this.operatorName = user.getLoginName();
        }
        if(Objects.nonNull(userInfo)){
            this.avatar = userInfo.getAvatar();
        }
        if (Objects.nonNull(linkImg)){
            this.imgList = linkImg;
        }
        if (Objects.nonNull(likeStatus)){
            this.likeStatus = likeStatus;
        }
    }

    private String id;


    private String avatar;

    /**
     * 文案内容
     */
    private String content;

    /**
     * 点赞数
     */
    private Integer likeCount;

    /**
     * 操作者id
     */
    private String operator;

    /**
     * 操作者名称
     */
    private String operatorName;


    /**
     * 创建时间
     */
    private Date createTime;


    /**
     * 关联图片列表
    * */
    private List<String> imgList;

    /**
     * 点赞状态
     * */
    private Boolean likeStatus;



}
